<?php
namespace app\api\validate;
use think\Validate;

/**
 * Class CarInfoValidate
 * @package app\api\validate
 * @author zhenHong~
 */
class CarInfoValidate extends Validate{
    protected $rule = [
        'id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'c_id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'b_id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        't_id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'm_id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'o_id' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'licenseplate' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'b_name' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        't_name' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'm_name' => ['require','regex'=>'/^[+]{0,1}(\d+)$/'],
        'c_ids'  => ['require']
    ];

    protected $message = [
        'id' => '参数错误id',
        'c_id' => '参数错误c_id',
        'b_id' => '参数错误b_id',
        't_id' => '参数错误t_id',
        'm_id' => '参数错误m_id',
        'o_id.require' => 'o_id不能为空',
        'o_id.regex' => '参数错误o_id',
        'b_name' => '品牌名不能为空b_name',
        'm_name' => '车型名不能为空m_name',
        't_name' => '车系名不能为空t_name',
        'c_ids'  => '车辆id不能为空'
    ];

    protected $scene = [
        // carInfo
        'carInfo' => ['o_id'],
        // 商户修改obd车辆信息
        'editCarInfo' => ['o_id'],
        // 用户批量删除车辆信息
        'delCarInfor' => ['c_ids']
    ];
}